package com.xiaohe66.web.infrastructure.domain.adapter.common;

import com.xiaohe66.web.domain.common.value.TagDesc;
import com.xiaohe66.web.domain.common.value.TagId;
import com.xiaohe66.web.domain.common.value.TagName;
import com.xiaohe66.web.infrastructure.domain.adapter.DataConverter;

/**
 * @author xiaohe
 * @since 2023.01.29 15:28
 */
public interface TagConverter extends DataConverter {

    default TagId toTagIds(Long tagId) {
        return ifPresent(tagId, TagId::new);
    }

    default TagName toTagName(String tagName) {
        return ifPresent(tagName, TagName::new);
    }

    default TagDesc toTagDesc(String tagDesc) {
        return ifPresent(tagDesc, TagDesc::new);
    }
}
